import Dependency from './dependency'

import Alert from '../packages/alert'
import Avatar from '../packages/avatar'
import Backtop from '../packages/backtop'
import Badge from '../packages/badge'
import Breadcrumb from '../packages/breadcrumb'
import Button from '../packages/button'
import Card from '../packages/card'
import Carousel from '../packages/carousel'
import Cascader from '../packages/cascader'
import Checkbox from '../packages/checkbox'
import Collapse from '../packages/collapse'
import Container from '../packages/container'
import Cropper from '../packages/cropper'
import DatePicker from '../packages/date-picker'
import Dialog from '../packages/dialog'
import Divider from '../packages/divider'
import Drawer from '../packages/drawer'
import Dropdown from '../packages/dropdown'
import Editor from '../packages/editor'
import Form from '../packages/form'
import Grid from '../packages/grid'
import Image from '../packages/image'
import Input from '../packages/input'
import Layout from '../packages/layout'
import Link from '../packages/link'
import Modal from '../packages/modal'
import NavMenu from '../packages/nav-menu'
import PageHeader from '../packages/page-header'
import Popconfirm from '../packages/popconfirm'
import Popover from '../packages/popover'
import Progress from '../packages/progress'
import Radio from '../packages/radio'
import Scrollbar from '../packages/scrollbar'
import Select from '../packages/select'
import Slider from '../packages/slider'
import Slert from '../packages/steps'
import Switch from '../packages/switch'
import Table from '../packages/table'
import Tabs from '../packages/tabs'
import Tag from '../packages/tag'
import TimePicker from '../packages/time-picker'
import Timeline from '../packages/timeline'
import Tooltip from '../packages/tooltip'
import Transfer from '../packages/transfer'
import Tree from '../packages/tree'
import Upload from '../packages/upload'
import Rate from '../packages/rate'
import ColorPicker from '../packages/color-picker'
import Pagination from '../packages/pagination'
import Skeleton from '../packages/skeleton'
import Empty from '../packages/empty'
import Descriptions from '../packages/descriptions'
import Result from '../packages/result'
import Calendar from '../packages/calendar'

import {Loading as _Loading, MessageBox, Notification, Message as _Message} from 'element-ui'

export const Loading = _Loading
export const Message = _Message

const components = [
    Alert,
    Avatar,
    Backtop,
    Badge,
    Breadcrumb,
    Button,
    Card,
    Carousel,
    Cascader,
    Checkbox,
    Collapse,
    Container,
    Cropper,
    DatePicker,
    Dialog,
    Divider,
    Drawer,
    Dropdown,
    Editor,
    Form,
    Grid,
    Image,
    Input,
    Layout,
    Link,
    Modal,
    NavMenu,
    PageHeader,
    Popconfirm,
    Popover,
    Progress,
    Radio,
    Scrollbar,
    Select,
    Slider,
    Slert,
    Switch,
    Table,
    Tabs,
    Tag,
    TimePicker,
    Timeline,
    Tooltip,
    Transfer,
    Tree,
    Upload,
    Rate,
    ColorPicker,
    Pagination,
    Skeleton,
    Empty,
    Descriptions,
    Result,
    Calendar,
]

const install = function (Vue, pluginOptions = {}) {
    Dependency(Vue, pluginOptions)

    Vue.prototype.$HZTECH = {
        locale: pluginOptions.locale || 'zh_CN',
    }

    components.forEach(component => {
        component.install(Vue, pluginOptions)
    })

    Vue.prototype.$loading = Loading.service
    Vue.prototype.$msgbox = MessageBox
    Vue.prototype.$alert = MessageBox.alert
    Vue.prototype.$confirm = MessageBox.confirm
    Vue.prototype.$prompt = MessageBox.prompt
    Vue.prototype.$notify = Notification
    Vue.prototype.$message = Message
}

const plugin = {
    version: '1.0.0',
    install,
    Alert,
    Avatar,
    Backtop,
    Badge,
    Breadcrumb,
    Button,
    Card,
    Carousel,
    Cascader,
    Checkbox,
    Collapse,
    Container,
    Cropper,
    DatePicker,
    Dialog,
    Divider,
    Drawer,
    Dropdown,
    Editor,
    Form,
    Grid,
    Image,
    Input,
    Layout,
    Link,
    Modal,
    NavMenu,
    Popconfirm,
    Popover,
    Progress,
    Radio,
    Scrollbar,
    Select,
    Slider,
    Slert,
    Switch,
    Table,
    Tabs,
    Tag,
    TimePicker,
    Timeline,
    Tooltip,
    Transfer,
    Tree,
    Upload
}

export default plugin
